package org.wenzi.com.agg;

import org.apache.flink.api.common.functions.AggregateFunction;
import org.wenzi.com.pojo.UserBehaviorPojo;


/**
 * @author zhaozuowen
 * @date 2021-10-25 11:41
 */
public class CountAgg implements AggregateFunction<UserBehaviorPojo,Long,Long> {
    @Override
    public Long createAccumulator() {
        return 0L;
    }

    @Override
    public Long add(UserBehaviorPojo userBehaviorPojo, Long acc) {
        return acc+1;
    }

    @Override
    public Long getResult(Long acc) {
        return acc;
    }

    @Override
    public Long merge(Long acc1, Long acc2) {
        return acc1+acc2;
    }
}
